<?php
session_start();
//session_register('login_state');
//$_SESSION['login_state'] ;
//===========================================================
$path = '../';
include($path."common.php");
include($path."prod_fun.php");
//=========================================================== 
$pageout = "staff_login.php" ; 
if($_SESSION['login_state'] <> "S"){
	gotopage($pageout) ;
} 
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../css/cart.css" />
<?
$id = $_GET['id'];
echo "<form method=post id=frm name=frm action=\"staff_act.php?nowpage=$nowpage\">" ;
echo "<table width=300 border=1 align=center cellspacing=1 cellpadding=1>" ;
//===========================================================
$sql_edit = "select * from kart_manage where user_id = '$id' " ;
$result_edit = mysql_query($sql_edit);
$row_edit=mysql_fetch_object($result_edit);
$staff_no = $row_edit->user_id ;
$staff_name = $row_edit->user_name ;
$staff_account = $row_edit->user_account ;
$staff_pwd = $row_edit->user_password ;
$staff_auth = $row_edit->user_auth ;
$staff_valid = $row_edit->user_valid ;
$staff_mail = $row_edit->user_mail ;

switch ($staff_auth){
	case "S":
		$auth_name = "系統管理員" ;
		break;
	case "P":
		$auth_name = "商品管理員" ;
		break;
	case "O":
		$auth_name = "訂單管理員" ;
		break;
}

if($staff_valid == "Y"){
	$valid = "啟用" ;
}elseif ($staff_valid == "N"){
	$valid = "關閉" ; 
}
//===========================================================
echo "<input name=txt1 type=hidden size=20 value='$staff_no'>" ;
echo "<tr>" ;
echo "<td align=right>使用者名稱:</td>" ;
echo "<td align=left><input name=txt2 type=text size=20 value='$staff_name'></td>" ;
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>帳號:</td>" ;
echo "<td align=left><input name=txt3 type=text size=20 value='$staff_account'></td>" ;
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>密碼:</td>" ;
echo "<td align=left><input name=txt4 type=text size=20 value='$staff_pwd'></td>" ;
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>信箱:</td>" ;
echo "<td align=left><input name=txt7 type=text size=20 value='$staff_mail'></td>" ;
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>權限:</td>" ;
echo "<td align=left><select name=txt5>" ;
echo "<option value='$staff_auth'>".$auth_name."</option>" ;
echo "<option value='S'>"."系統管理員"."</option>" ;
echo "<option value='P'>"."商品管理員"."</option>" ;
echo "<option value='O'>"."訂單管理員"."</option>" ;
echo "</select>" ;
echo "</td>";
echo "</tr>" ;
echo "<tr>" ;
echo "<td align=right>權限開放:</td>" ;
echo "<td align=left><select name=txt6>" ;

echo "<option value='$staff_valid'>".$valid."</option>" ;	


echo "<option value='Y'>"."啟用"."</option>" ;
echo "<option value='N'>"."關閉"."</option>" ;
echo "</select>" ;
echo "</td>";
echo "</tr>" ;
//===========================================================
echo "<tr>" ;
echo "<td colspan=2>" ;
echo "<table width=100% border=0 align=center cellspacing=1 cellpadding=1>" ;
echo "<tr>" ;
if($id){ 
echo "<td width=50% align=right><input name=action type=submit value='修改'></td>" ;
}else{
echo "<td width=50% align=right><input name=action type=submit value='新增'></td>" ;
}
echo "<td width=50% align=left><input name=action type=submit value='返回清單'></td>" ;
echo "</tr>" ;
echo "</table>" ;
echo "</td>" ;
echo "</tr>" ;
//===========================================================
echo "</table>" ;
//===========================================================
echo "</form>" ;
?>